package servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import domain.DirectBet;
import domain.Player;
import domain.Table;

public class MakeBetServlet extends HttpServlet {
	@Override
	protected void doPost(HttpServletRequest req, HttpServletResponse resp)
			throws ServletException, IOException {
		int number = Integer.parseInt(req.getParameter("number"));
		int amount = Integer.parseInt(req.getParameter("amount"));
		
		Player player = (Player)req.getSession().getAttribute("player");
		Table table = (Table)req.getSession().getAttribute("table");
		req.getParameterMap();
				
		AuxTable auxTable = new AuxTable();
		
		auxTable.addBet(number,amount, player, table);
		req.getSession().setAttribute("rows", auxTable.getRows());
		
		req.getRequestDispatcher("table.jsp").forward(req, resp);
	}
}
